package com.eckey.lab.config;

import com.eckey.lab.aop.SpringAopLogAspect;
import com.eckey.lab.properties.AopLogProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: Marinc
 * @CreateTime: 2023-12-18  15:16
 * @Description: TODO
 * @Version: 1.0
 */
@Configuration
@EnableConfigurationProperties({AopLogProperties.class})
@ConditionalOnProperty(prefix = "aop.log",
        value = "enabled", havingValue = "true")
public class AopLogConfig {

    @Bean
    @ConditionalOnMissingBean
    public SpringAopLogAspect springLogAspect() {
        return new SpringAopLogAspect();
    }

}
